package cn.edu.scau.cmi.yangjiamin.singleormulti;

import java.util.List;
import java.util.ArrayList;

public class ChairmanMulti {
	private String name;
	private static List<ChairmanMulti> chairmanMultiList = new ArrayList<>();
	
	private ChairmanMulti(String name) {
		this.name = name;
	}
	
	public static List<ChairmanMulti> addInstance(String name){
		if(chairmanMultiList.size() < 3) {
			ChairmanMulti chairmanMulti = new ChairmanMulti(name);
			chairmanMultiList.add(chairmanMulti);
		}
		else {
			System.out.println("最多只能添加三位主席" + name + "无法添加");
		}
		return chairmanMultiList;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getName() {
		return name;
	}

}
